' This program exported from BASIC Anywhere Machine (Version [5.2.3].[2024.09.09.00.00]) on 2025.02.15 at 18:32 (Coordinated Universal Time)
' Program by Charlie Veniot
' Using DRAW to "spirograph" ellipses
' Rotating the ellipses on an axis to create a colorful circle
' 🟠🟠🟠 Declarations
CONST s% = 201, _ ' Screen dimension (width and height)
scm% = ( s% - 1 ) / 2 ' Middle coordinates of screen (x and y)
DIM aColor%( 1 TO 62 ) ' Color palette array
VAR maxColors% ' Max number of colours for current drawing iteration
VAR aE% ' angle of ellipse
VAR aG% ' angle for position of a spirographing "gear" in the spirographing frame
' 🟠🟠🟠 Main program
SCREEN _NEWIMAGE( s%, s%, 17)
aE% = 0
➔Iteration:
GOSUB 🎨SetColorPalette
FOR aE% = 0 TO 359
c% = aColor%( INT( RND * maxColors% ) + 1 )
GOSUB 🖌DrawEllipse
IF aE% MOD 3 = 0 THEN SLEEP 0.001
NEXT aE%
SLEEP 2
GOTO ➔Iteration
END
' 🟠🟠🟠 GOSUB Routines
🎨SetColorPalette:
maxColors% = INT( RND * 60 ) + 2
FOR i% = 1 TO maxColors%
aColor%( i% ) = INT( RND * 62 ) + 1
NEXT i%
RETURN
🖌DrawEllipse:
' Well, about a quarter of an ellipse
FOR aG% = 95 TO 185 STEP 1
DRAW "BM " + scm% + "," + scm%
DRAW "B TA " + ( aE% + aG% ) + " U" + ( scm% - 45 )
DRAW "B TA " + ( 450 + aE% - aG% ) + " R39"
CIRCLE ( POINT(0), POINT(1) ), 1, c%, , , , T
NEXT aG%
RETURN